package cn.cttic.link.controller;

import cn.cttic.common.core.domain.R;
import cn.cttic.link.api.domain.bo.DeviceActiveBo;
import cn.cttic.link.api.domain.vo.DeviceActiveResultVo;
import cn.cttic.link.service.IMapGooNoticeService;
import cn.cttic.order.api.RemoteInstallOrderService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 第三方接口 - 麦谷接口
 */
@Slf4j
@RestController("/mapgoo")
@RequiredArgsConstructor
public class MapGooNoticeController {

    private final IMapGooNoticeService noticeService;

    /**
     * 设备激活通知接口
     * @param bo 设备激活信息
     * @return
     */
    @PostMapping("/deviceActiveNotice")
    public R<DeviceActiveResultVo> deviceActiveNotice(@RequestBody DeviceActiveBo bo) {
        try {
            DeviceActiveResultVo vo = noticeService.excuteNoticeAction(bo);

            return R.ok(vo);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return R.fail(e.getMessage());
        }
    }
}
